import Vue from 'vue'
import Element from '@/utils/element-ui'
import PsMessage from '@/components/message/index'
import PsMessageBox from '@/components/message-box/index'
// import 'element-ui/lib/theme-chalk/index.css'
import './theme/index.scss'
import '@/styles/elements/index.scss'
import '@/styles/reset-elements.scss'
import '@/styles/reset.scss'
import '@/styles/common.scss'
import '@/styles/index.scss'
import App from './App'
import store from './store'
import router from './router'
import ElementResizeDetectorMaker from 'element-resize-detector'

import './icons'
import { invokeAPi, registerInformApi, invokeAsyncAPi } from '@/xz-fn.js'
import * as filters from './filters'
import './directive'
import './permission'
import { gotoLogin, gotoMember, gotoUserToken, gotoEnergyRules, gotoEnergyRecord } from '@/utils'

Vue.use(Element)
Vue.prototype.$PsMessage = PsMessage
Vue.prototype.$PsMessageBox = PsMessageBox
Vue.prototype.$xz = invokeAPi
Vue.prototype.$xzAsy = invokeAsyncAPi
Vue.prototype.$xzReg = registerInformApi
Vue.prototype.$erd = ElementResizeDetectorMaker()

Vue.prototype.$gotoLogin = gotoLogin
Vue.prototype.$gotoMember = gotoMember
Vue.prototype.$gotoUserToken = gotoUserToken
Vue.prototype.$gotoEnergyRules = gotoEnergyRules
Vue.prototype.$gotoEnergyRecord = gotoEnergyRecord
// Vue.prototype.$rootNode = null
// Vue.prototype.$curNode = null

// register global utility filters
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})

Vue.config.productionTip = false
// eslint-disable-next-line
const app = new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
